'''
Created on 22-Apr-2013

@author: cdac
'''
from matplotlib import pyplot
from random import randint

class StatsPlot():
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
        pass
    
    def max_plot(self, x_axis, ham_max_stat_raw, ham_max_stat_prep, ham_max_stat_no_sw, spam_max_stat_raw, spam_max_stat_prep, spam_max_stat_no_sw):

        max_figure = pyplot.figure()
        axis = max_figure.add_axes([0.1, 0.1, 0.6, 0.75])
        axis.plot(x_axis, ham_max_stat_raw, label="Ham Raw")
        axis.plot(x_axis, ham_max_stat_prep, label="Ham Pre-processed")
        axis.plot(x_axis, ham_max_stat_no_sw, label="Ham no Stopwords")
        
        axis.plot(x_axis, spam_max_stat_raw, label="Spam Raw")
        axis.plot(x_axis, spam_max_stat_prep, label="Spam Pre-processed")
        axis.plot(x_axis, spam_max_stat_no_sw, label="Spam no Stopwords")
        
        axis.set_xlabel('Number of Messages', size=18)
        axis.set_ylabel('Maximum size of Messages', size=18)
        axis.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
        
        pyplot.savefig("../Output/max_msg_size_plot.png")
        pyplot.show()

    def size_plot(self, x_axis, ham_msg_size_raw, ham_msg_size_prep, ham_msg_size_no_sw, spam_msg_size_raw, spam_msg_size_prep, spam_msg_size_no_sw):
        max_figure = pyplot.figure()
        axis = max_figure.add_axes([0.1, 0.1, 0.6, 0.75])
        axis.plot(x_axis, ham_msg_size_raw, label="Ham Raw")
        axis.plot(x_axis, ham_msg_size_prep, label="Ham Pre-processed")
        axis.plot(x_axis, ham_msg_size_no_sw, label="Ham no Stopwords")
        
        axis.plot(x_axis, spam_msg_size_raw, label="Spam Raw")
        axis.plot(x_axis, spam_msg_size_prep, label="Spam Pre-processed")
        axis.plot(x_axis, spam_msg_size_no_sw, label="Spam no Stopwords")
        
        axis.set_xlabel('Number of Messages', size=18)
        axis.set_ylabel('Size of Messages', size=18)
        axis.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
        
        pyplot.savefig("../Output/msg_size_plot.png")
        pyplot.show()

        
if __name__ == '__main__':
    statsPlot = StatsPlot()
    
    ham_max_stat_raw = list()
    spam_max_stat_raw = list()
    
    ham_max_stat_prep = list()
    spam_max_stat_prep = list()
    
    x_axis_range = range(50, 400, 50)
    for i in x_axis_range:
        ham_max_stat_raw.append(randint(3,140))
        ham_max_stat_prep.append(randint(3,140))
        spam_max_stat_raw.append(randint(3,140))
        spam_max_stat_prep.append(randint(3,140))
       
        
    statsPlot.max_plot(x_axis_range, ham_max_stat_raw, ham_max_stat_prep, spam_max_stat_raw, spam_max_stat_prep)